from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from django.http import JsonResponse


# Create your views here.

class ImageCodeView(View):

    def get(self, request):
        # from libs.captcha.captcha import captcha
        # text, image = captcha.generate_captcha()
        from django_redis import get_redis_connection
        redis_cli = get_redis_connection('code')
        redis_cli.setex('18900127193', 100, '122')

        pipline = redis_cli.pipeline()
        pipline.setex('18900127196', 100, '号码是18900127193')
        pipline.setex('send_flag_12', 100, 'send_flag_12')
        pipline.execute()
        return JsonResponse({'code': 0, 'count': '1', 'errmsg': 'ok'})
